UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LhToRCALn89MDzhXDzyjbwV1FL7fc8gIi10EPI9yF/8=' 
WHERE 
  key_id = 'a6191b27654f9461bf13684542b03bd863d8e99b355debaff0464258c27e9082' 
  AND (
    token = 'LhToRCALn89MDzhXDzyjbwV1FL7fc8gIi10EPI9yF/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025