UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b2YGUvdulFThL1r8xhtihjDHGea5jz5za6nSkRNBDkA=' 
WHERE 
  key_id = 'e7cef431f054f1988edad0baa8a1267de073cc8586400a123be075a069243717' 
  AND (
    token = 'b2YGUvdulFThL1r8xhtihjDHGea5jz5za6nSkRNBDkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024