UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xn0O/7moxFgRgufZtd7Q4Z+lBw0u76pw/n9u8tohv6w=' 
WHERE 
  key_id = '55a677398276e45c18a297ee2be9b3e097e4ca99b2da1b7d0ddf04fdd70cc266' 
  AND (
    token = 'Xn0O/7moxFgRgufZtd7Q4Z+lBw0u76pw/n9u8tohv6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053