UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LehkV8a+ESJgLQkUzEyD4I4/viNaDzQ0ztgpi+an/h4=' 
WHERE 
  key_id = 'd8351f6a7fc3947f808579ad38e36868eea84bfaee5a5534d8ed99cb422299dd' 
  AND (
    token = 'LehkV8a+ESJgLQkUzEyD4I4/viNaDzQ0ztgpi+an/h4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048