UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I94AzLPK5/p5eJJoNABe4nvo+vgRgJk3QaLCVZxB5xE=' 
WHERE 
  key_id = '1dcf003f2ba0612a68817241b13304257307ce35fdf2dd8a1ece737fcccbf320' 
  AND (
    token = 'I94AzLPK5/p5eJJoNABe4nvo+vgRgJk3QaLCVZxB5xE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039