UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qAifJHzrPkfxldmdrviGDl+ZKv4pxB94j3jXX0YTCCI='
WHERE
key_id = '7191ae5a82f966932a2efab713352d82f30c8e980d99325811a950068c8009a0'
AND (
token = 'qAifJHzrPkfxldmdrviGDl+ZKv4pxB94j3jXX0YTCCI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)