UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5A5lhLLkv28ZTywzMAerQgYzlR5SYgAcGDDyaFqPpbc='
WHERE
key_id = '8f8d1ddcbe91587e0ce45de8c873197bae9bd4862040019f87be106162c99c7f'
AND (
token = '5A5lhLLkv28ZTywzMAerQgYzlR5SYgAcGDDyaFqPpbc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)