UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ldIdcn6ml/SAdFm3nl+SKSFJWEnThq61PID5u+uVrkc='
WHERE
key_id = '0e8134bad1dd1384363a26dda7e4b452f548f053787e8fdb4d28793b2af0ea04'
AND (
token = 'ldIdcn6ml/SAdFm3nl+SKSFJWEnThq61PID5u+uVrkc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)