UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T+KrNBMVm7MbDQ3LYZtiuGPRyL1JHqRTccJ5i8nomwg='
WHERE
key_id = 'b122549e4ae7e75add3ce8447169cd370cd6a67a70f095f273859d3c5c76745a'
AND (
token = 'T+KrNBMVm7MbDQ3LYZtiuGPRyL1JHqRTccJ5i8nomwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)