UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NaKVV1aCSP2SfuS82Zhmi49qi2sx6Osq8FiEG5xk13s='
WHERE
key_id = '1551f3f531a9c810877a73423eb247e767e05b679edaac63558346efab3989fc'
AND (
token = 'NaKVV1aCSP2SfuS82Zhmi49qi2sx6Osq8FiEG5xk13s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)