UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5+DH0iF0oVLyxZSLJVNI81MoJrPXb1o7QhICQflUKSQ=' 
WHERE 
  key_id = '25d55926e79b7466e1d15f6e93ab407399094d836edd3f1900a79f3968b49064' 
  AND (
    token = '5+DH0iF0oVLyxZSLJVNI81MoJrPXb1o7QhICQflUKSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025