UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y54JCUavC77X5FOBvNBX5+tAcIMG5VpAMAryVYlgcrc='
WHERE
key_id = '034ebac9edb6f365f450856c900c5fa766e603d70f747b3204097cf67a63b2de'
AND (
token = 'Y54JCUavC77X5FOBvNBX5+tAcIMG5VpAMAryVYlgcrc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)