UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ypFr57eG9xuKXNn1gg6seb+ejISnqHyjDV4klJlbR4=' 
WHERE 
  key_id = 'e34cc430aaa5170c08df06429af75d2a729ba8fbbd6b13e0dfda1f223870f129' 
  AND (
    token = '1ypFr57eG9xuKXNn1gg6seb+ejISnqHyjDV4klJlbR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034