UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8DP9VuNuLJaimPISsVCSmhRJ+7Isf/20cIMhG26ZZwc='
WHERE
key_id = '78589576c220882995710ab532b7baecf799b8618a7b6b7a06f385f3745a3f07'
AND (
token = '8DP9VuNuLJaimPISsVCSmhRJ+7Isf/20cIMhG26ZZwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)