UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DwuxSYwgNxC2ShPsChUdABXt30WZVB6Lb/8TQH9Ggzs=' 
WHERE 
  key_id = '5a77c9e45ee484d9517800a38ee23843326c7a938c0d392d0f2506964901e7d7' 
  AND (
    token = 'DwuxSYwgNxC2ShPsChUdABXt30WZVB6Lb/8TQH9Ggzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050