UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zSlck0vhvJps3DK57jIXi6miBaIXGbIhjIE+B8+a6Q8='
WHERE
key_id = 'fdf306647ea626fa4cd0c7d3f2ebf2e6bb2025c6efc0fa04727ea925901f8f54'
AND (
token = 'zSlck0vhvJps3DK57jIXi6miBaIXGbIhjIE+B8+a6Q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)