UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i2v+SfShzxlvh3dgOa5WNUdKIOhT8WGiUOdDLWyPj+M=' 
WHERE 
  key_id = '2a8a64986f8959c86f158f878ba563f4a2aa74d8bf4e13caf58590308475e9a3' 
  AND (
    token = 'i2v+SfShzxlvh3dgOa5WNUdKIOhT8WGiUOdDLWyPj+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043