UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MAuElpxlqg7roJhrTxLKVkkGctrROHurrlkXKBqzXBc=' 
WHERE 
  key_id = 'b301267e12545b909f590b1c68f04d09a47251b9221e26de74bc84d231801e24' 
  AND (
    token = 'MAuElpxlqg7roJhrTxLKVkkGctrROHurrlkXKBqzXBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027