UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p5EHCp6mabkInvOPWGO4ObX1bagnJOSt8hiqPNyqf+E='
WHERE
key_id = '138d2d54332e5e0f6afd8f7af12f778b89153392e5b9bec33002335e339c7b49'
AND (
token = 'p5EHCp6mabkInvOPWGO4ObX1bagnJOSt8hiqPNyqf+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)