UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yPregeul3BwAJjBwAt63VCNgUcGm8h+o2lEctOiR9HE=' 
WHERE 
  key_id = 'bdd2b2fbf3c3c409c40f9a5c37b0e3e970811288ecb7c9e851b5cb2d8603e9a3' 
  AND (
    token = 'yPregeul3BwAJjBwAt63VCNgUcGm8h+o2lEctOiR9HE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047