UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Okdr512qF6Cqnf0kFqgMxvgDMAiXNtkaFEk/5oqhZCI='
WHERE
key_id = 'e5b3d1da93468dfc8bdbaae6820e3082826c5a6063df69b3c488f36018a4ad6a'
AND (
token = 'Okdr512qF6Cqnf0kFqgMxvgDMAiXNtkaFEk/5oqhZCI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)