UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y/NO6Qv6sm+tMxLi15j/UuLVVmyOvsHY4xwoQK8BLpQ=' 
WHERE 
  key_id = 'fa31fae651abd0271e1e658776d57b2e075790088e5e4ae186e8acbfb4808f36' 
  AND (
    token = 'Y/NO6Qv6sm+tMxLi15j/UuLVVmyOvsHY4xwoQK8BLpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029