UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4i83c6aCsf/j5TucXpVw8XXs6DuTXpbISo4CrNi9Nn4='
WHERE
key_id = '3623790d735460b2b5ac11dfd68982f4940147ac8505028e60b5584bcc7a5305'
AND (
token = '4i83c6aCsf/j5TucXpVw8XXs6DuTXpbISo4CrNi9Nn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)