UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'thhZfCgjk4icr+Au6Fmevr7Upqeoy0I4agAnn+vZMR8='
WHERE
key_id = '3c8f14ac1e53882c051791671b8dced5455df08a91d5d6038a53618f0cdbc618'
AND (
token = 'thhZfCgjk4icr+Au6Fmevr7Upqeoy0I4agAnn+vZMR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)