UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NJ0XG0eZLBAiKnIEtkdqYtfofjlKTQFsT2dt8FPh1CE=' 
WHERE 
  key_id = '2bfeb703860af95c4618cd30e40478efcb48565e744da68f13ba00593ae00909' 
  AND (
    token = 'NJ0XG0eZLBAiKnIEtkdqYtfofjlKTQFsT2dt8FPh1CE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027